﻿package 
{
	import chamans.away.c1gt;
	import chamans.away.sol;
	import chamans.engine.Away4;
	import chamans.engine.Jiglib;
	import flash.geom.Vector3D;
	
	[SWF(backgroundColor="#000000", frameRate="120", width="960", height="540")]
	
	public class carDrive extends Away4
	{
		public function carDrive()
		{
			var DEF:Object={  
				phy:true, fog:true, reflect:true, sky:true,
				titre:"BASE", message:"Car simulator with jiglib",
				color:[0x8E806F, 0x195BB2, 0x6491CC, 0x8E806F, 600, 0, 1, false, true],
				// camera set
				fov:50, far:5000, near:1, type:"normal", H:90, V:-90, 
				position : new Vector3D(0, 120, 0), targetDistance :1000
			}
			super(INIT3D, oo, DEF);
		}
		private function INIT3D():void
		{
			// light set
			Lights.add("point", 0xeeEFff, -405, 330, -405, .8, 1, false , null, true ,300, 3000);
			Lights.add("point", 0xFFEFee, 405, 330, -405, .8, 1, false , null, true ,300, 3000);
			//	physics set
			if(phyOn){ physics=new Jiglib(this, 6, 0.16); physics.add_Plan(.3, .8); }
			// map set
			Camera.plan( 'mapbase', .3,  new Vector3D(50,.5,2048), null, TMP, false);
		}	
		private function TMP():void
		{
			G = new sol( this, NEXT0);
		}
		private function NEXT0():void 
		{ 
			CAR = new c1gt( this , NEXT1);
		}
		private function NEXT1():void 
		{ 
			Camera.target=CAR.container
			Shadows(1);	
		}
		
		private function oo():void 
		{	
			if(CAR)CAR.update()
		}
		
		private var G:sol;
		private var CAR:c1gt;
		
	}}
